#!/bin/bash

umount -f /dev/nvme0n1
umount -f /dev/nvme1n1
umount -f /dev/nvme2n1

sed -i '/ssd1/d' /etc/fstab
sed -i '/ssd2/d' /etc/fstab
sed -i '/ssd3/d' /etc/fstab

mount -a

mkfs.ext4 -t /dev/nvme0n1 
sleep 20
mkfs.ext4 -t /dev/nvme1n1 
sleep 30
mkfs.ext4 -t /dev/nvme2n1

uuid1=`blkid /dev/nvme0n1 | awk '{print $2}' | sed 's/\"//' | sed 's/\"$//'`
uuid2=`blkid /dev/nvme1n1 | awk '{print $2}' | sed 's/\"//' | sed 's/\"$//'`
uuid3=`blkid /dev/nvme2n1 | awk '{print $2}' | sed 's/\"//' | sed 's/\"$//'`

echo "$uuid1 /ssd1 ext4 ">>/etc/fstab
echo "$uuid2 /ssd2 ext4 ">>/etc/fstab
echo "$uuid3 /ssd3 ext4 ">>/etc/fstab

mount -a
